<?php

namespace app\api\controller;

use app\common\controller\Api;
use think\Db;

class Discount extends Api
{
    protected $noNeedLogin = ['discountlist'];
    protected $noNeedRight = ['*'];
    /**
     * 优惠列表
     *
     */
    public function discountlist()
    {
        $cate = Db::name('discount')->order('id desc')->field('id,money,duration')->select();
        foreach ($cate as $k=>$v){
            $cate[$k]['wenan'] = '赠送'.floatval($v['duration']).'小时充电时长';
        }

        $this->success('请求成功',$cate);
    }
}